using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class PlayAudioSource : MonoBehaviour
{
    public UnityEvent OnPlayFinished;

    public void Execute()
    {
        var audioSource = GetComponent<AudioSource>();
        audioSource.Play();
        float time = audioSource.clip.length;
        Invoke("OnFinished",time);
    }

    private void OnFinished()
    {
        OnPlayFinished?.Invoke();
    }
}
